<?php
/**
 * controller index
 * 
 * @author gudals
 *
 */

class ctIndex extends commController
{
    public $action = 'index';

    public function __construct($params = array())
    {
        parent::__construct($params);
    }
    
    public function index()
    {
        //commViewer::_css($this->aCss);
        //commViewer::_js($this->aJs);
        
        // layout 비활성
        $this->sTopLayoutView = false;
        $this->sFooterLayoutView = false;
        
        $aAssignData = array();
        
        // display view
        $this->view('/cont/intro.html', $aAssignData);
    }

    public function login()
    {
        //commViewer::_css($this->aCss);
        //commViewer::_js($this->aJs);

        // layout 비활성
        $this->sTopLayoutView = false;
        $this->sFooterLayoutView = false;

        $aAssignData = array();

        // display view
        $this->view('/cont/login.html', $aAssignData);
    }

   /**
    *
    * 로그아웃
    */
    public function logout()
    {
        commSession::session_destroy();
        utilMust::locationReplace('/');
    }

    /**
     *
     * 로그인 처리
     */
    public function loginAction()
    {
        // 임시 로그인
        $returnUrl = '/';
        
        if ($this->params['user_id'] == 'gudals' || $this->params['user_id'] == 'admin') {
            $aLoginInfo = array(
                'usess' => 1,
                'uid' => 'gudals',
                'utype' => 'N',
                'ulevel' => 1,
                'uservcie' => $this->params['service_num'],
                'uname' => '김형민'
            );

            $returnUrl = '/cont/';
        }

        foreach ($aLoginInfo as $key => $val) {
            commSession::session_register($key, $val);
        }
        
        commSession::register();

        utilMust::locationReplace($returnUrl);

        //header("location: ".$returnUrl);

        // 아이디 비번을 체크
    }
}